package dq.study.java.grammar.generator;

import java.sql.Ref;
import java.util.ArrayList;
import java.util.List;

/**
 * Class#getGenericInterfaces 得到接口的泛型
 * Class#getGenericSuperclass 得到超类的泛型
 *
 * @author dongqun
 * @version 1.0.0
 * @since 2021/09/26 11:25:00
 */
public class ReflectTest {
    public static void main(String[] args) {
        Foo<TEXE> foo = new Foo<TEXE>() {
        };
//        System.out.println(ReflectTest.class.getSuperclass());
//        System.out.println(foo.getClass().getSuperclass());
        System.out.println(foo.getClass().getGenericInterfaces());
        System.out.println(foo.getClass().getGenericSuperclass());
//        System.out.println(foo.getClass().getTypeParameters());
        System.out.println("-------------");
        Foo<Long> foo2 = new Foo<Long>() {
        };
//        System.out.println(ReflectTest.class.getSuperclass());
//        System.out.println(foo2.getClass().getSuperclass());
        System.out.println(foo2.getClass().getGenericInterfaces());
        System.out.println(foo2.getClass().getGenericSuperclass());
//        System.out.println(foo2.getClass().getTypeParameters());

        List<String> sss = new ArrayList<>();
        System.out.println(sss.getClass().getGenericInterfaces());
    }

    private static class Foo<T> {
        T t;

        public T getT() {
            return t;
        }

        public void setT(T t) {
            this.t = t;
        }
    }

    private static class TEXE {

    }
}
